#include "hasquarterstate.h"

#include <qDebug>

HasQuarterState::HasQuarterState(GumballMachine *machine)
    : m_machine(machine)
{
}

void HasQuarterState::insertQuarter()
{
    qDebug() << "sorry, you has inserted a another quarter!";
}

void HasQuarterState::ejectQuarter()
{
    qDebug() << "quarter returned!";
    if (m_machine)
    {
        m_machine->setState(m_machine->getNoQuarterState());
        qDebug() << "into no quarter state!";
    }
}

void HasQuarterState::turnCrank()
{
    if (m_machine)
    {
        m_machine->setState(m_machine->getSellingState());
    }
}

void HasQuarterState::dispense()
{
    qDebug() << "please turn the crank first!";
}
